<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>
        // 1. 获取当前日期对象
        const date = new Date()
        console.log(date)

        // 年
        console.log(date.getFullYear())
        // 月，从零开始，要+1
        console.log(date.getMonth() + 1)
        // 日
        console.log(date.getDate())

        // 星期几，0是星期天
        console.log(date.getDay())

        console.log(date.getHours())
        console.log(date.getMinutes())
        console.log(date.getSeconds())

        

    </script>
    
</body>
</html>